<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2016/11/23 0023
  Time: 上午 8:42
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<% boolean isLoginError = request.getParameterMap().containsKey("login_error") ; %>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="${cdnContentPath}/static/bootstrap-3.3.5/css/bootstrap.min.css" rel="stylesheet">
    <link href="${cdnContentPath}/static/bootstrap-3.3.5/css/datepicker3.css" rel="stylesheet">
    <link href="${cdnContentPath}/static/bootstrap-3.3.5/css/styles.css" rel="stylesheet">
    <script src="${cdnContentPath}/static/bootstrap-3.3.5/js/html5shiv.min.js"></script>
    <script src="${cdnContentPath}/static/bootstrap-3.3.5/js/respond.min.js"></script>
    <title>Business Login Page</title>
</head>
<body style="padding-bottom: 20%;background-color:#4C9CF5">
<div class="alert alert-info alert-dismissable" style="color:red ;text-align: center; display:none" id="error">
    <button type="button" class="close" data-dismiss="alert" aria-hidden="true">
        ×
    </button>
    账号或密码错误，请重试！
</div>
<form action="${ctx}/mulanweb/common/login_out/sellerLogin" method="post">
        <div style="width:30%;margin:0 auto;">
            <img src="../../static/image/loginout/logo.jpg" class="img-thumbnail">
            <%--<img src="../../static/image/loginout/logo.jpg" width="155" style="margin:0 auto"/>--%>
        </div>
        <div style="text-align: center;font-family: 微软雅黑;color:white">
            t.im/newzealand
        </div>
        <div style="height:20%"></div>
        <div style="width:80%; margin: 0 auto;">
            <input class="form-control has-error" name="username" id="username" type="text" placeholder="Please input account" style="height:45px;background: url(../../static/image/loginout/username.png) center left no-repeat;background-color: white;background-size:10%;padding-left:40px; ">
            <div style="height:20px"></div>
            <input type="password" class="form-control has-error" name="password" id="password" placeholder="Please input password" style="height:45px;background: url(../../static/image/loginout/password.png) center left no-repeat;background-color: white;background-size:10%;padding-left:40px; ">
        </div>
        <div style="height:20px"></div>
        <button type="button" class="btn btn-default btn-login" style="width:60%;background-color: white;margin-left:20%">Submit</button>
    <input type="hidden" name="loginType" id="loginType" value="2"/>
</form>
<script src="${cdnContentPath}/static/jquery/jquery-3.1.0.min.js"></script>
<script src="${cdnContentPath}/static/bootstrap-3.3.5/js/bootstrap.min.js"></script>
<script type="text/javascript">
    $(function(){
        if(window.parent.location.href != window.location.href) {
            window.parent.location.href = window.location.href;
            return;
        }

        <%if (isLoginError) {%>
        $("#error").css("display","block") ;
        <%}%>
        var $username = $("#username"), $password = $("#password");
        $(document).on("keypress blur", "#username", function () {
            if ($username.val()) {
                $username.parent().removeClass("has-error");
            } else {
                $username.parent().addClass("has-error");
            }
        }).on("keypress blur", "#password", function () {
            if ($password.val()) {
                $password.parent().removeClass("has-error");
            } else {
                $password.parent().addClass("has-error");
            }
        }).on("click", ".btn-login", function () {
            var username = $username.val(), password = $password.val();
            if (!username) {
                $username.parent().addClass("has-error").focus();
                return false;
            } else {
                $username.parent().removeClass("has-error");
            }
            if(!password) {
                $password.parent().addClass("has-error").focus();
                return false;
            } else {
                $password.parent().removeClass("has-error");
            }

            $("form").submit();
        })
    })
</script>
</body>
</html>
